﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MoneyDistr.Question;

namespace MoneyDistribution.Answer
{
    class Jimson : IMoneyDistr
    {
     
        long IMoneyDistr.GetCount(int n, int[] Base)
        {
            if (n < 1)
                return 0;
            int dis = n / 7;
            int rest = n % 7;
            if (rest < 3)
                return dis + rest;
            if (rest > 3 && rest < 5)
                if (dis > 0)
                    return dis + 1 + rest - 3;
                else
                    return rest;
            if (rest == 5)
                return 1 + dis;
            if (rest > 5 && rest < 7)
                return 1 + rest - 5 + dis;
            return 0;
        }
    }
}
